/**
* @author Max Rupplin
* @date 4-21-08
* @file DDAS_Work_Handler.hpp
*/

#ifndef DDAS_WORK_HANDLER_HPP
#define DDAS_WORK_HANDLER_HPP

/// The class responsible for performing the function of work generation for the DDAS project
class DDAS_Work_Handler
{

	public:

	DDAS_Work_Handler();

	~DDAS_Work_Handler();

	int DDAS_Work_Handler::isDoneWith( int job_id );

	int DDAS_Work_Handler::get_related_state_files( char*** state_file_names, char** scoping_file_names, long starting_value, long ending_value );
	
	int DDAS_Work_Handler::write_state_files_to_download_dir( char** state_file_names, long starting_value, long ending_value );

	int DDAS_Work_Handler::write_to_file(char* data, char* path);

	long DDAS_Work_Handler::get_file_size(char* path);

	int DDAS_Work_Handler::get_related_data_file(int pid, char** content, char** name);

	int DDAS_Work_Handler::get_related_scoping_files(int pid, char*** content, char*** names, unsigned long starting_value, unsigned long ending_value);
	
	char* DDAS_Work_Handler::write_data_file_to_download_dir(char* content, char* name);
	
	char** DDAS_Work_Handler::write_scoping_files_to_download_dir( char** files, char** names, unsigned long starting_value, unsigned long ending_value);

	void DDAS_Work_Handler::create_workunits(int pid, char* data_file_name, char** scoping_file_names, char** state_file_names, unsigned long starting_value, unsigned long ending_value );

	int DDAS_Work_Handler::exists_new_work();
	
	int DDAS_Work_Handler::set_job_to_processed(int pid);
};

#endif
